package com.af.monitorModule.controller.statistics;

import com.af.monitorModule.generator.service.function.FunctionService;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/statistics")
public class DataController {

    @Autowired
    private FunctionService functionService;

    @GetMapping("/welcome")
    public JSONObject getWelcome() {
        return functionService.getWelcome();
    }

    @GetMapping("/welcomeCompany")
    public JSONObject getWelcomeCompany() {
        return functionService.getWelcomeCompany();
    }

    @GetMapping("/WelcomeServer")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public JSONObject getWelcomeServer() {
        return functionService.getWelcomeServer();
    }

    @GetMapping("/WelcomeCountLine")
    public JSONObject getWelcomeCountLine(String day) {
        return functionService.getWelcomeCountLine(day);
    }
}
